<template>
	<f7-page class="home">
		<f7-navbar>
			<f7-nav-left>
				<f7-link icon-if-ios="f7:menu" icon-if-md="material:menu" panel-open="left"></f7-link>
			</f7-nav-left>
			<f7-nav-title>护理</f7-nav-title>
			<f7-nav-right>
				<f7-link href="javascript:;" @click="go('/home_code/')">扫描</f7-link>
				<!-- <f7-link href="javascript:;"  @click="go('/lookRoom/room:402881ec6284f4ae016284f6d3eb0000/')">查房</f7-link> -->
			</f7-nav-right>
		</f7-navbar>
		<!-- 手风琴列表 -->
		<f7-list accordion class="margin0">
			<f7-list-item accordion-item v-for="(val,key) in huliList.registBedList" :key="key" :title="val.roomName">
				<f7-accordion-content>
					<div class="row no-gap">
					  	<div v-for="(val2,key2) in val.value" :key="key2" class="col-50" @click="go('/about/'+val2.oldId+'/')">
							<f7-card :title="val2.bedName+' '+val2.oldName">
								<f7-card-content>
									<f7-badge class="marginB10">特饮</f7-badge>
									<f7-badge class="marginB10">褥疮</f7-badge>
									<f7-badge class="marginB10">长嘱</f7-badge>
									<f7-badge>临嘱</f7-badge>
									<f7-badge :class="val2.outside ? 'color-red':''">外出</f7-badge>
								</f7-card-content>
							</f7-card>
					  	</div>
					</div>
				</f7-accordion-content>
			</f7-list-item>
		</f7-list>
	</f7-page>
</template>
<script>
	import { AndroidControl, JavascriptInterface } from "@/utils/AndroidBridge.js";
	export default {
		name:'home',
		data() {
			return {
				huliList:[],
			}
		},
		created: function() {
			var that = this;
			//监听NFC扫描事件
			// new JavascriptInterface().jsNFCReceiver((tag) => {
			// 	var val = {},zu = tag.split(":");
			// 		val.name = zu[0];
			// 		val.id = zu[1];
			// 		// alert(tag);
			// 	if(val.name=='caregivers'){//老人手环id跳转老人详情界面
			// 		// alert('老人手环id')
			// 		that.go('/about/'+val.id+'/')
			// 	}else if(val.name=='room'){
			// 		alert('房间id')
			// 	}else if(val.name=='jordan'){
			// 		alert('坐便器id')
			// 	}else {
			// 		that.go('/home_code/')
			// 	}
			// });
		},
		mounted () {
			var that = this;
			that.$post(global.COURSES.path + '/registBed/myBedList1', {'careId':global.COURSES.careId})
				.then(message => {
					if(message.code==0){
						that.huliList = JSON.parse(message.data);
						if(!that.huliList.registBedList[0].value[0].oldName){
							that.huliList.registBedList[0].value=[];
							var arrJ = {};
								arrJ.oldName = that.huliList.registBedList[0].oldName;
								arrJ.oldId = that.huliList.registBedList[0].oldId;
								arrJ.bedName = that.huliList.registBedList[0].bedName;
								arrJ.outside = that.huliList.registBedList[0].outside;
								that.huliList.registBedList[0].value.push(arrJ);
						}
					}
				})
		},
		methods: {
			go: function(path){
				this.$f7.views.main.router.navigate(path);
			},
		}
	}
</script>